package org.jwos.platform.desktop.login.web;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.interceptor.ServletRequestAware;
import org.jwos.platform.desktop.web.BaseActionSupport;
import org.jwos.platform.service.SessionManager;

public class LogoutAction extends BaseActionSupport implements ServletRequestAware {
	
	private SessionManager sessionManager;
	
	private HttpServletRequest request;
	
	public void setSessionManager(SessionManager sessionManager) {
		this.sessionManager = sessionManager;
	}
	
	public void setServletRequest(HttpServletRequest request) {
		this.request = request;
	}

    public String execute() throws Exception {
		this.request.getSession().removeAttribute("user");
		this.sessionManager.unregisterSession(this.request.getSession().getId());
		return SUCCESS;      
    }
}